<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>houdunren.com</title>
</head>

<body>
	<script>
		// new Array
		// let array = [["hdcms"], ["houdunren", "cms"]];
		// let lessons = [{ name: "php", click: 33 }, { name: "js", click: 99 }];
		// console.log(array[1][1]);
		// console.log(lessons[1].name);
		// const name = 3;
		// name = 5;
		// const arr = [1, 2];
		// arr[1] = 99;
		// console.log(arr);
		let arr = [1,44,44, 22, 33, 44,11]
		
		const filterNonUnique = (arr) => {
			return arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i))
		};
	// console.log(filterNonUnique(a));

	// arr.filter((item,index)=>{
	// 	return arr.indexOf(item)==index
	// })

	function unique(arr) {
			let newArr = []
			let obj = {}
			arr.forEach(item => {
				if (typeof item !== 'object') {
					if (newArr.indexOf(item) === -1) {
						newArr.push(item)
					}
				} else {
					let str = JSON.stringify(item)
					if (!obj[str]) {
						newArr.push(item)
						console.log(11,obj[str])
						obj[str] = 1
						console.log(22,obj[str])
					}
				}
				console.log(obj);
			})
			return newArr
		}

	

		unique([123, 123, [1, 2, 3], [1, '2', 3], [1, 3, 4], [1, 2, 3], { a: 1 }, { a: 1 }, 'hello'])
	</script>
</body>

</html>